package mysrpringboot.springboot.Dao;

import mysrpringboot.springboot.pojo.Order;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

@Repository
public interface OrderDao extends JpaRepository<Order,Long> {
    @Modifying
    @Transactional
    @Query(value = "update order set num =?1 where id ='1'",nativeQuery = true)
    void update(int num);

    @Query(value = "select num from order where id =1",nativeQuery = true)
    int findNum();
}
